﻿<Popups:PopupControl x:Class="MyToolkit.UI.Popups.ListPickerBox"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:MyToolkit.Controls"
                     xmlns:Popups="clr-namespace:MyToolkit.UI.Popups"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}">

	<Popups:PopupControl.Resources>
		<Popups:BaseViewModel x:Key="viewModel" />
		<DataTemplate x:Key="multipleTemplate">
			<CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}" Content="{Binding Item}" Click="ButtonBase_OnClick" />
		</DataTemplate>
		<DataTemplate x:Key="singleTemplate">
			<RadioButton GroupName="list" IsChecked="{Binding IsChecked, Mode=TwoWay}" Content="{Binding Item}" />
		</DataTemplate>
	</Popups:PopupControl.Resources>

	<Grid x:Name="LayoutRoot" DataContext="{StaticResource viewModel}">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>

		<TextBlock x:Name="title" Grid.Row="0" Grid.ColumnSpan="3" Margin="24,40,24,8"
				   Style="{StaticResource PhoneTextNormalStyle}" FontSize="33" FontWeight="Medium" />
		
		<Button x:Name="SelectAllButton" Margin="12,12,12,-12" Grid.Row="1" Click="OnSelectAll" />

		<Controls:MtListBox x:Name="list" Grid.Row="2" InnerMargin="12,24,12,0" />
		
		<Grid Grid.Row="3" Margin="12">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="0.5*" />
				<ColumnDefinition Width="0.5*" />
			</Grid.ColumnDefinitions>

			<Button Content="{Binding Strings.ListPickerPopupCancel}" Grid.Column="0" 
					Click="OnCancel" FontSize="{StaticResource PhoneFontSizeMedium}" />
			<Button Content="{Binding Strings.ListPickerPopupAccept}" Grid.Column="1" x:Name="acceptButton"
					Click="OnAccept" FontSize="{StaticResource PhoneFontSizeMedium}" />
		</Grid>
    </Grid>
</Popups:PopupControl>
